package CTRLayer;

import java.util.ArrayList;
import DBLayer.DBLogbook;
import DBLayer.DBLogbookIF;
import ModelLayer.Logbook;

public class LogbookCTR
{
	public ArrayList<Logbook> findAllLogbooks()
    {
		DBLogbook dbLogbook = new DBLogbook();
        ArrayList<Logbook> allLogbooks = new ArrayList<Logbook>();
        allLogbooks = dbLogbook.getAllLogbook(false);
        return allLogbooks;
    }
	
	public Logbook findLogbookID(int LogbookID)
	{
		DBLogbook dbLogbook = new DBLogbook();
		return dbLogbook.searchLogbookID(LogbookID, true);
	}
	
	public ArrayList<Logbook> findAllLogbooksByTrainedID(int trainedID)
    {
		DBLogbook dbLogbook = new DBLogbook();
        ArrayList<Logbook> allLogbooks = new ArrayList<Logbook>();
        allLogbooks = dbLogbook.getAllLogbooksByTrainedID(trainedID, false);
        return allLogbooks;
    }
	
	public static void createLogbook(String pmDate, String note, int trainedID)
	{
	    DBLogbookIF dbLogbook = new DBLogbook();
	    Logbook logbook = new Logbook();
	    logbook.setDate(pmDate);
	    logbook.setNote(note);
	    logbook.setTrainedID(trainedID);
	    dbLogbook.insertLogbook(logbook);
	}
}